home *** CD-ROM | disk | FTP | other *** search
/ Champak 106 / Vol 106.iso / games / jet_boat.swf / scripts / frame_83 / DoAction.as
Encoding:
Text File  |  2010-04-12  |  10.8 KB  |  515 lines

  1. function Pr_Car()
  2. {
  3.    var _loc3_ = {x:_root.car.pt1._x,y:_root.car.pt1._y};
  4.    _root.car.localToGlobal(_loc3_);
  5.    var _loc2_ = {x:_root.car.pt2._x,y:_root.car.pt2._y};
  6.    _root.car.localToGlobal(_loc2_);
  7.    var _loc9_ = {x:_root.car.pt3._x,y:_root.car.pt3._y};
  8.    _root.car.localToGlobal(_loc9_);
  9.    var _loc8_ = {x:_root.car.pt4._x,y:_root.car.pt4._y};
  10.    _root.car.localToGlobal(_loc8_);
  11.    var _loc4_ = Math.max(_loc3_.x,_loc2_.x);
  12.    _loc4_ = Math.max(_loc4_,_loc9_.x);
  13.    _loc4_ = Math.max(_loc4_,_loc8_.x);
  14.    var _loc6_ = Math.min(_loc3_.x,_loc2_.x);
  15.    _loc6_ = Math.min(_loc6_,_loc9_.x);
  16.    _loc6_ = Math.min(_loc6_,_loc8_.x);
  17.    var _loc5_ = Math.max(_loc3_.y,_loc2_.y);
  18.    _loc5_ = Math.max(_loc5_,_loc9_.y);
  19.    _loc5_ = Math.max(_loc5_,_loc8_.y);
  20.    var _loc7_ = Math.min(_loc3_.y,_loc2_.y);
  21.    _loc7_ = Math.min(_loc7_,_loc9_.y);
  22.    _loc7_ = Math.min(_loc7_,_loc8_.y);
  23.    if(_root.doroga.hitTest(_loc4_,_root.car._y,true))
  24.    {
  25.       _root.car._x -= _root.speed2;
  26.       if(_root.p > 0.5)
  27.       {
  28.          _root.p -= _root.speed2 * 2;
  29.       }
  30.       else if(_root.p < 0.5)
  31.       {
  32.          _root.p += _root.speed2 * 2;
  33.       }
  34.    }
  35.    if(_root.doroga.hitTest(_loc6_,_root.car._y,true))
  36.    {
  37.       _root.car._x += _root.speed2;
  38.       if(_root.p > 0.5)
  39.       {
  40.          _root.p -= _root.speed2 * 2;
  41.       }
  42.       else if(_root.p < 0.5)
  43.       {
  44.          _root.p += _root.speed2 * 2;
  45.       }
  46.    }
  47.    if(_root.doroga.hitTest(_root.car._x,_loc5_,true))
  48.    {
  49.       _root.car._y -= _root.speed2;
  50.       if(_root.p > 0.5)
  51.       {
  52.          _root.p -= _root.speed2 * 2;
  53.       }
  54.       else if(_root.p < 0.5)
  55.       {
  56.          _root.p += _root.speed2 * 2;
  57.       }
  58.    }
  59.    if(_root.doroga.hitTest(_root.car._x,_loc7_,true))
  60.    {
  61.       _root.car._y += _root.speed2;
  62.       if(_root.p > 0.5)
  63.       {
  64.          _root.p -= _root.speed2 * 2;
  65.       }
  66.       else if(_root.p < 0.5)
  67.       {
  68.          _root.p += _root.speed2 * 2;
  69.       }
  70.    }
  71. }
  72. function MoveAll(nextl)
  73. {
  74.    speed = 3;
  75.    speedbot = 3.5;
  76.    speed2 = 0.4;
  77.    otkl = 6;
  78.    if(p < 2)
  79.    {
  80.       car.flame.gotoAndStop(1);
  81.       netrofl = false;
  82.       if(_root.netro.dwn)
  83.       {
  84.          _root.netro.gotoAndPlay(1);
  85.          _root.msnd.Playsnd(4);
  86.       }
  87.    }
  88.    if(p > 0)
  89.    {
  90.       if(_root.netrofl)
  91.       {
  92.          spm.speed._rotation = 85;
  93.       }
  94.       else
  95.       {
  96.          spm.speed._rotation = p * 50 - 90;
  97.       }
  98.    }
  99.    if(p < 0)
  100.    {
  101.       spm.speed._rotation = (- p) * 10 - 90;
  102.    }
  103.    gameDate = new Date();
  104.    sec = gameDate.getSeconds();
  105.    min = gameDate.getMinutes();
  106.    mls = int(gameDate.getMilliseconds() / 10);
  107.    if(mls < 10)
  108.    {
  109.       mls = "0" + mls;
  110.    }
  111.    gts = sec - startsec;
  112.    gtm = min - startmin;
  113.    if(gtm < 0)
  114.    {
  115.       gtmp = gtm + 60;
  116.    }
  117.    else
  118.    {
  119.       gtmp = gtm;
  120.    }
  121.    if(gts < 0)
  122.    {
  123.       gtsl = gts + 60;
  124.    }
  125.    else
  126.    {
  127.       gtsl = gts;
  128.    }
  129.    if(gts < 10 and gts > -1)
  130.    {
  131.       gtsl = "0" + gtsl;
  132.    }
  133.    if(gtsl == 0)
  134.    {
  135.       gtml = gtmp;
  136.    }
  137.    if(gtml < 1)
  138.    {
  139.       time = "00:" + gtsl + ":" + mls;
  140.    }
  141.    else
  142.    {
  143.       time = gtml + ":" + gtsl + ":" + mls;
  144.    }
  145.    if(p < 0.05 && p > 0.049 || p < 0.02 && p > 0.019 || p < 0.04 && p > 0.039 || p < 0.03 && p > 0.029 || p < 0.01 && p > 0.009 || p < 0.01 && p > 0)
  146.    {
  147.       p = 0;
  148.    }
  149.    car._x += p * Math.cos(0.017453292519943295 * _root.rotcar);
  150.    car._y += p * Math.sin(0.017453292519943295 * _root.rotcar);
  151.    car2._x += p2 * Math.cos(0.017453292519943295 * _root.rotcar2);
  152.    car2._y += p2 * Math.sin(0.017453292519943295 * _root.rotcar2);
  153.    car3._x += p3 * Math.cos(0.017453292519943295 * _root.rotcar3);
  154.    car3._y += p3 * Math.sin(0.017453292519943295 * _root.rotcar3);
  155.    car4._x += p4 * Math.cos(0.017453292519943295 * _root.rotcar4);
  156.    car4._y += p4 * Math.sin(0.017453292519943295 * _root.rotcar4);
  157.    rotcar = getProperty("/car", _rotation);
  158.    rotcar2 = getProperty("/car2", _rotation);
  159.    rotcar3 = getProperty("/car3", _rotation);
  160.    rotcar4 = getProperty("/car4", _rotation);
  161.    prov._x = car._x;
  162.    prov._y = car._y;
  163.    prov._rotation = car._rotation;
  164.    prov._visible = 0;
  165.    if(p > 0)
  166.    {
  167.       if(car.hitTest("/fon"))
  168.       {
  169.          p -= 0.02;
  170.       }
  171.    }
  172.    if(p < 0)
  173.    {
  174.       if(car.hitTest("/fon"))
  175.       {
  176.          p += 0.02;
  177.       }
  178.    }
  179.    if(p2 < 0)
  180.    {
  181.       if(car2.hitTest("/fon"))
  182.       {
  183.          p2 += 0.02;
  184.       }
  185.    }
  186.    if(p3 < 0)
  187.    {
  188.       if(car3.hitTest("/fon"))
  189.       {
  190.          p3 += 0.02;
  191.       }
  192.    }
  193.    if(p4 < 0)
  194.    {
  195.       if(car4.hitTest("/fon"))
  196.       {
  197.          p4 += 0.02;
  198.       }
  199.    }
  200. }
  201. function MyCarSelect(col)
  202. {
  203.    col2 = col + 1;
  204.    if(col2 > 4)
  205.    {
  206.       col2 = 1;
  207.    }
  208.    col3 = col2 + 1;
  209.    if(col3 > 4)
  210.    {
  211.       col3 = 1;
  212.    }
  213.    col4 = col3 + 1;
  214.    if(col4 > 4)
  215.    {
  216.       col4 = 1;
  217.    }
  218.    _root.car.gotoAndStop(col);
  219.    _root.car2.gotoAndStop(col2);
  220.    _root.car3.gotoAndStop(col3);
  221.    _root.car4.gotoAndStop(col4);
  222. }
  223. function SetEndTime()
  224. {
  225.    stoptime2 = new Date();
  226.    secstop2 = stoptime2.getSeconds();
  227.    minstop2 = stoptime2.getMinutes();
  228.    ssl2 = secstop2 - startsec;
  229.    msl2 = minstop2 - startmin;
  230.    if(msl2 < 0)
  231.    {
  232.       mslp2 = msl2 + 60 - 1;
  233.    }
  234.    else
  235.    {
  236.       mslp2 = msl2 - 1;
  237.    }
  238.    if(ssl2 < 0)
  239.    {
  240.       sslp2 = ssl2 + 60;
  241.    }
  242.    else
  243.    {
  244.       sslp2 = ssl2;
  245.    }
  246.    if(mslp2 < 1)
  247.    {
  248.       _root.timelast2 = sslp2 + "sec";
  249.    }
  250.    else
  251.    {
  252.       _root.timelast2 = mslp2 + "min" + " " + sslp2 + "sec";
  253.    }
  254. }
  255. function CarBot2(ll)
  256. {
  257.    rand = random(ll) * 0.03;
  258.    if(_root.p2 < _root.speed + rand)
  259.    {
  260.       _root.p2 += 0.1 + rand;
  261.    }
  262.    with(_root.car)
  263.    {
  264.       if(_root.car2.hitTest(getBounds(_root).xMax,_y,true))
  265.       {
  266.          _x -= 0.5;
  267.       }
  268.       if(_root.car2.hitTest(getBounds(_root).xMin,_y,true))
  269.       {
  270.          _x += 0.5;
  271.       }
  272.       if(_root.car2.hitTest(_x,getBounds(_root).yMax,true))
  273.       {
  274.          _y -= 0.5;
  275.       }
  276.       if(_root.car2.hitTest(_x,getBounds(_root).yMin,true))
  277.       {
  278.          _y += 0.5;
  279.       }
  280.    }
  281.    with(_root.car3)
  282.    {
  283.       if(_root.car2.hitTest(getBounds(_root).xMax,_y,true))
  284.       {
  285.          _rotation -= 3;
  286.          _x -= 0.5;
  287.       }
  288.       if(_root.car2.hitTest(getBounds(_root).xMin,_y,true))
  289.       {
  290.          _rotation -= 3;
  291.          _x += 0.5;
  292.       }
  293.       if(_root.car2.hitTest(_x,getBounds(_root).yMax,true))
  294.       {
  295.          _rotation -= 3;
  296.          _y -= 0.5;
  297.       }
  298.       if(_root.car2.hitTest(_x,getBounds(_root).yMin,true))
  299.       {
  300.          _rotation -= 3;
  301.          _y += 0.5;
  302.       }
  303.    }
  304.    with(_root.car4)
  305.    {
  306.       if(_root.car2.hitTest(getBounds(_root).xMax,_y,true))
  307.       {
  308.          _rotation -= 3;
  309.          _x -= 0.5;
  310.       }
  311.       if(_root.car2.hitTest(getBounds(_root).xMin,_y,true))
  312.       {
  313.          _rotation -= 3;
  314.          _x += 0.5;
  315.       }
  316.       if(_root.car2.hitTest(_x,getBounds(_root).yMax,true))
  317.       {
  318.          _rotation -= 3;
  319.          _y -= 0.5;
  320.       }
  321.       if(_root.car2.hitTest(_x,getBounds(_root).yMin,true))
  322.       {
  323.          _rotation -= 3;
  324.          _y += 0.5;
  325.       }
  326.    }
  327. }
  328. function CarBot3(ll)
  329. {
  330.    rand = random(ll) * 0.03;
  331.    if(_root.p3 < _root.speed + rand)
  332.    {
  333.       _root.p3 += 0.1 + rand;
  334.    }
  335.    with(_root.car)
  336.    {
  337.       if(_root.car3.hitTest(getBounds(_root).xMax,_y,true))
  338.       {
  339.          _x -= 0.5;
  340.       }
  341.       if(_root.car3.hitTest(getBounds(_root).xMin,_y,true))
  342.       {
  343.          _x += 0.5;
  344.       }
  345.       if(_root.car3.hitTest(_x,getBounds(_root).yMax,true))
  346.       {
  347.          _y -= 0.5;
  348.       }
  349.       if(_root.car3.hitTest(_x,getBounds(_root).yMin,true))
  350.       {
  351.          _y += 0.5;
  352.       }
  353.    }
  354.    with(_root.car2)
  355.    {
  356.       if(_root.car3.hitTest(getBounds(_root).xMax,_y,true))
  357.       {
  358.          _rotation -= 3;
  359.          _x -= 0.5;
  360.       }
  361.       if(_root.car3.hitTest(getBounds(_root).xMin,_y,true))
  362.       {
  363.          _rotation -= 3;
  364.          _x += 0.5;
  365.       }
  366.       if(_root.car3.hitTest(_x,getBounds(_root).yMax,true))
  367.       {
  368.          _rotation -= 3;
  369.          _y -= 0.5;
  370.       }
  371.       if(_root.car3.hitTest(_x,getBounds(_root).yMin,true))
  372.       {
  373.          _rotation -= 3;
  374.          _y += 0.5;
  375.       }
  376.    }
  377.    with(_root.car4)
  378.    {
  379.       if(_root.car3.hitTest(getBounds(_root).xMax,_y,true))
  380.       {
  381.          _rotation -= 3;
  382.          _x -= 0.5;
  383.       }
  384.       if(_root.car3.hitTest(getBounds(_root).xMin,_y,true))
  385.       {
  386.          _rotation -= 3;
  387.          _x += 0.5;
  388.       }
  389.       if(_root.car3.hitTest(_x,getBounds(_root).yMax,true))
  390.       {
  391.          _rotation -= 3;
  392.          _y -= 0.5;
  393.       }
  394.       if(_root.car3.hitTest(_x,getBounds(_root).yMin,true))
  395.       {
  396.          _rotation -= 3;
  397.          _y += 0.5;
  398.       }
  399.    }
  400. }
  401. function CarBot4(ll)
  402. {
  403.    rand = random(ll) * 0.03;
  404.    if(_root.p4 < _root.speed + rand)
  405.    {
  406.       _root.p4 += 0.1 + rand;
  407.    }
  408.    with(_root.car)
  409.    {
  410.       if(_root.car4.hitTest(getBounds(_root).xMax,_y,true))
  411.       {
  412.          _x -= 0.5;
  413.       }
  414.       if(_root.car4.hitTest(getBounds(_root).xMin,_y,true))
  415.       {
  416.          _x += 0.5;
  417.       }
  418.       if(_root.car4.hitTest(_x,getBounds(_root).yMax,true))
  419.       {
  420.          _y -= 0.5;
  421.       }
  422.       if(_root.car4.hitTest(_x,getBounds(_root).yMin,true))
  423.       {
  424.          _y += 0.5;
  425.       }
  426.    }
  427.    with(_root.car2)
  428.    {
  429.       if(_root.car4.hitTest(getBounds(_root).xMax,_y,true))
  430.       {
  431.          _x -= 0.5;
  432.       }
  433.       if(_root.car4.hitTest(getBounds(_root).xMin,_y,true))
  434.       {
  435.          _x += 0.5;
  436.       }
  437.       if(_root.car4.hitTest(_x,getBounds(_root).yMax,true))
  438.       {
  439.          _y -= 0.5;
  440.       }
  441.       if(_root.car4.hitTest(_x,getBounds(_root).yMin,true))
  442.       {
  443.          _y += 0.5;
  444.       }
  445.    }
  446.    with(_root.car3)
  447.    {
  448.       if(_root.car4.hitTest(getBounds(_root).xMax,_y,true))
  449.       {
  450.          _rotation -= 3;
  451.          _x -= 0.5;
  452.       }
  453.       if(_root.car4.hitTest(getBounds(_root).xMin,_y,true))
  454.       {
  455.          _rotation -= 3;
  456.          _x += 0.5;
  457.       }
  458.       if(_root.car4.hitTest(_x,getBounds(_root).yMax,true))
  459.       {
  460.          _rotation -= 3;
  461.          _y -= 0.5;
  462.       }
  463.       if(_root.car4.hitTest(_x,getBounds(_root).yMin,true))
  464.       {
  465.          _rotation -= 3;
  466.          _y += 0.5;
  467.       }
  468.    }
  469. }
  470. function SetEndGame()
  471. {
  472.    stopAllSounds();
  473.    laps = "5";
  474.    netrofl = false;
  475.    stay = 1;
  476.    t = 15;
  477.    p = 0;
  478.    p2 = 0;
  479.    p3 = 0;
  480.    p4 = 0;
  481.    lap = 1;
  482.    lap2 = 1;
  483.    lap3 = 1;
  484.    lap4 = 1;
  485.    po1 = 0;
  486.    po2 = 0;
  487.    po3 = 0;
  488.    pob3_2 = 0;
  489.    pob3_3 = 0;
  490.    pob3_4 = 0;
  491.    ran = random(10);
  492.    netro.gotoAndStop(1);
  493.    car.flame.gotoAndStop(1);
  494. }
  495. if(map == 2)
  496. {
  497.    gotoAndStop("to2");
  498.    play();
  499. }
  500. if(map == 3)
  501. {
  502.    gotoAndStop("to3");
  503.    play();
  504. }
  505. if(map == 4)
  506. {
  507.    gotoAndStop("to4");
  508.    play();
  509. }
  510. if(map == 5)
  511. {
  512.    gotoAndStop("to5");
  513.    play();
  514. }
  515.